
namespace test {
  // 1.
  interface Product {
    readonly id: number;
    name: string;
    price: number
    description?: string | undefined
  }

  const product1: Product = {
    id: 1,
    name: "iPhone",
    price: 999
  }

  // 2.
  type Add = (a: number, b: number) => number
  const add: Add = (a, b) => a + b

  // 3.
  type Greet = (name?: string | undefined) => string
  const greet: Greet = (name = '天使') => 'hello' + (name || '')

  // 4.
  interface User {
    name: string
    age: number
  }
  function CreateUser(name: string, age: number): User {
    return { name, age }
  }
  const createUser = CreateUser('天使', 18)

  // 5.
  const Products: Product[] = [
    { id: 1, name: "iPhone", price: 999 },
    { id: 2, name: "MacBook", price: 1299 },
    { id: 3, name: "iPad", price: 799 }
  ]

  // 6.
  interface Func {
    ():void
  }

  // 7.
  enum Status {
    off,
    on
  }

  // 8.
  interface User{
    name:string
    age:number
  }
  interface Contact {
    email:string
    phone:String
  }
  type UserConcact = User&Contact
  // 
}